package com.xq.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/17 19:18
 * @description 过滤器配置类
 */
public class AppFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        String env = filterConfig.getInitParameter("env");
        String hello = filterConfig.getInitParameter("hello");
        System.out.println(env+"  "+hello);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("doFilter");
        chain.doFilter(request,response);
    }

    @Override
    public void destroy() {
        System.out.println("tomcat容器销毁才调用");
    }
}
